<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>

  <style>
    * {
      margin: 0;
      padding: 0;
    }

    div.show {
      width: 400px;
      height: 150px;
      border: 10px solid pink;
      margin: 30px auto;
      display: flex;
      justify-content: space-evenly;
      align-items: center;
      position: relative;
    }

    img {
      width: 100px;
      height: 100px;
      display: block;
    }

    .current {
      width: 288px;
      height: 180px;
      position: absolute;
      top: 0;
      left: 0;
      display: none;
    }

    .current>img {
      width: 100%;
      height: 100%;
    }
  </style>
</head>

<body>

  <div class="show">
    <img src="1.png" alt="">
    <img src="2.png" alt="">
    <img src="3.png" alt="">
    <div class="current">
      <img src="1.png" alt="">
    </div>
  </div>



  <script src='https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js'></script>

  <script>
    //1.鼠标移入移出图片 让current显示和隐藏

    $(".show>img").mouseenter(function () {
      $('.current').fadeIn(500)
    })


    $(".show>img").mouseleave(function () {
      $('.current').fadeOut(500)
    })

    //2.让current跟随鼠标移动

    $('.show>img').mousemove(function (e) {
      // console.log(e.offsetX)
      $('.current').css({ left: $(this).position().left + e.offsetX + 5, top: $(this).position().top + e.offsetY + 5 }).find('img').attr('src', $(this).attr('src'))

    })

    //3.让current中img的图片地址进行相应的切换

  </script>
</body>

</html>